<template>
	<view class="content">
		<view class="item-bg">
			<view class="item-left">
				<image class="icon" src="../../static/ic_device_2.png"></image>
			</view>
			<view class="text" style="margin-left: 40rpx;">总设备数</view>
			<view class="text text-num">{{statistics.总设备数量}}</view>
		</view>
		<view class="item-bg">
			<view class="item-left">
				<image class="icon" src="../../static/ic_device_2.png"></image>
			</view>
			<view class="text" style="margin-left: 40rpx;">可用数量</view>
			<view class="text text-num">{{statistics.可用数量}}</view>
		</view>
		
		<view class="item-bg">
			<view class="item-left">
				<image class="icon" src="../../static/ic_device_2.png"></image>
			</view>
			<view class="text" style="margin-left: 40rpx;">保养数量</view>
			<view class="text text-num">{{statistics.保养数量}}</view>
		</view>
		<view class="item-bg">
			<view class="item-left">
				<image class="icon" src="../../static/ic_device_2.png"></image>
			</view>
			<view class="text" style="margin-left: 40rpx;">维修数量</view>
			<view class="text text-num">{{statistics.维修数量}}</view>
		</view>
		<view class="item-bg">
			<view class="item-left">
				<image class="icon" src="../../static/ic_device_2.png"></image>
			</view>
			<view class="text" style="margin-left: 40rpx;">待点检数量</view>
			<view class="text text-num">{{statistics.待点检数量}}</view>
		</view>
		
		<view class="item-bg">
			<view class="item-left">
				<image class="icon" src="../../static/ic_device_2.png"></image>
			</view>
			<view class="text" style="margin-left: 40rpx;">停机数量</view>
			<view class="text text-num">{{statistics.停机数量}}</view>
		</view>
		<view class="item-bg">
			<view class="item-left">
				<image class="icon" src="../../static/ic_device_2.png"></image>
			</view>
			<view class="text" style="margin-left: 40rpx;">待保养数量</view>
			<view class="text text-num">{{statistics.待保养数量}}</view>
		</view>
		<view class="item-bg">
			<view class="item-left">
				<image class="icon" src="../../static/ic_device_2.png"></image>
			</view>
			<view class="text" style="margin-left: 40rpx;">机加运行数量</view>
			<view class="text text-num">{{statistics.jg_on_count}}/{{statistics.jg_total_count}}</view>
		</view>
		
		<view class="item-bg">
			<view class="item-left">
				<image class="icon" src="../../static/ic_device_2.png"></image>
			</view>
			<view class="text" style="margin-left: 40rpx;">铸造运行数量</view>
			<view class="text text-num">{{statistics.yz_on_count}}/{{statistics.yz_total_count}}</view>
		</view>
	</view>
</template>

<script>
	import {DeviceStatistics,DeviceStatus} from '../../common/device-api.js'
	
	export default {
		data() {
			return {
				statistics:{
					总设备数量:0,
					可用数量:0,
					停机数量:0,
					待保养数量:0,
					保养数量:0,
					维修数量:0,
					待点检数量:0,
					jg_on_count:0,
					jg_total_count:0,
					yz_on_count:0,
					yz_total_count:0,
				},
				
			};
		},
		onLoad(){
			console.log("onLoad>>>");
			this.loadData();
		},
		methods:{
			loadData(){
					  
				DeviceStatistics().then(res=>{
					console.log(res);
					var data = {};
					this.statistics.总设备数量 = res[0].value;
					this.statistics.可用数量 = res[1].value;
					this.statistics.停机数量 = res[2].value;
					this.statistics.待保养数量 = res[3].value;
					this.statistics.保养数量 = res[4].value;
					this.statistics.维修数量 = res[5].value;
					this.statistics.待点检数量 = res[6].value;
					console.log(this.statistics);
				});
				DeviceStatus().then(res=>{
					console.log(res);
					this.statistics.jg_on_count = res[0].jg_on_count;
					this.statistics.jg_total_count = res[0].jg_total_count;
					this.statistics.yz_on_count = res[0].yz_on_count;
					this.statistics.yz_total_count = res[0].yz_total_count;
					console.log(this.statistics);
				});
			},
			
			
		}
	}
</script>

<style lang="scss" scoped>
	@import url("./device.css");
</style>
